package com.ruoyi.slope.video.radar.controller;

import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.slope.video.radar.domain.RadarMonitoringScatter;
import com.ruoyi.slope.video.radar.service.IRadarMonitoringScatterService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 散射图Controller
 * 
 * @author ruoyi
 * @date 2025-09-06
 */
@RestController
@RequestMapping("/radar/scatter")
public class RadarMonitoringScatterController extends BaseController
{
    @Autowired
    private IRadarMonitoringScatterService radarMonitoringScatterService;

    /**
     * 查询散射图列表
     */
    @PreAuthorize("@ss.hasPermi('radar:scatter:list')")
    @GetMapping("/list")
    public TableDataInfo list(RadarMonitoringScatter radarMonitoringScatter)
    {
        startPage();
        List<RadarMonitoringScatter> list = radarMonitoringScatterService.selectRadarMonitoringScatterList(radarMonitoringScatter);
        return getDataTable(list);
    }

    /**
     * 导出散射图列表
     */
    @PreAuthorize("@ss.hasPermi('radar:scatter:export')")
    @Log(title = "散射图", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RadarMonitoringScatter radarMonitoringScatter)
    {
        List<RadarMonitoringScatter> list = radarMonitoringScatterService.selectRadarMonitoringScatterList(radarMonitoringScatter);
        ExcelUtil<RadarMonitoringScatter> util = new ExcelUtil<RadarMonitoringScatter>(RadarMonitoringScatter.class);
        String path = util.exportExcel(response, list, "散射图数据");
    }

    /**
     * 获取散射图详细信息
     */
    @PreAuthorize("@ss.hasPermi('radar:scatter:query')")
    @GetMapping(value = "/{atTime}")
    public AjaxResult getInfo(@PathVariable("atTime") Date atTime)
    {
        return success(radarMonitoringScatterService.selectRadarMonitoringScatterByAtTime(atTime));
    }

    /**
     * 新增散射图
     */
    @PreAuthorize("@ss.hasPermi('radar:scatter:add')")
    @Log(title = "散射图", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RadarMonitoringScatter radarMonitoringScatter)
    {
        return toAjax(radarMonitoringScatterService.insertRadarMonitoringScatter(radarMonitoringScatter));
    }

    /**
     * 修改散射图
     */
    @PreAuthorize("@ss.hasPermi('radar:scatter:edit')")
    @Log(title = "散射图", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RadarMonitoringScatter radarMonitoringScatter)
    {
        return toAjax(radarMonitoringScatterService.updateRadarMonitoringScatter(radarMonitoringScatter));
    }

    /**
     * 删除散射图
     */
    @PreAuthorize("@ss.hasPermi('radar:scatter:remove')")
    @Log(title = "散射图", businessType = BusinessType.DELETE)
	@DeleteMapping("/{atTimes}")
    public AjaxResult remove(@PathVariable Date[] atTimes)
    {
        return toAjax(radarMonitoringScatterService.deleteRadarMonitoringScatterByAtTimes(atTimes));
    }
}
